#!/bin/bash
clear
RED="\033[31m"    # Error message
GREEN="\033[32m"  # Success message
YELLOW="\033[33m" # Warning message
BLUE="\033[36m"   # Info message
RESET='\033[0m'

if [ "$EUID" -ne 0 ]; then
  echo -e "${RED} Anda tiada kebenaran untuk menjalankan skrip ini! ${RESET}"
  exit 1
fi

dependencies=(perl libnet-ssleay-perl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions)
for pkg in "${dependencies[@]}"; do
  apt-get -y -qq install $pkg
done

wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
echo 'deb http://download.webmin.com/download/repository sarge contrib' | tee /etc/apt/sources.list.d/webmin.list

apt-get -qq update
apt-get -y -qq install webmin

sed -i "s|ssl=1|ssl=0|g" /etc/webmin/miniserv.conf
sed -i "s|ipv6=1|ipv6=0|g" /etc/webmin/miniserv.conf
systemctl restart webmin

echo
echo -e "${GREEN} Pemasangan webmin pakej telah selesai. ${RESET}"
echo
